<?
include '../conn.php';
include "t-cookie.php";
$tid=$_SESSION["t-id"];
?>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人资料-教师端</title>
    <link rel="stylesheet" type="text/css" href="../css/htmleaf-demo.css">
    <link rel="stylesheet" type="text/css" href="../css/nav.css">
    <link rel="stylesheet" type="text/css" href="../fonts/iconfont.css">

    <link rel="stylesheet" href="../css/bootstrap-theme.css" />

    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css" />
    <link rel="stylesheet" href="../css/bootstrap.css" />
    <script type="text/javascript" src="../js/bootstrap3.0.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../layer/theme/default/layer.css">
    <link rel="stylesheet" type="type/css" href="../layer/mobile/need/layer.css">

    <link rel="stylesheet" type="text/css" href="../css/style.css">


    <script>
        $(function () {
            $("[data-toggle='popover']").popover();
        });
    </script>
</head>
<body class="bodycolor">

<nav class="navbar navbar-default navbar-fixed-top" style="clear: left;">
    <div class="container">
        <div class="navbar-right navfont" id="navbar-collapse">
            <p>华软网络技术系毕业管理系统</p>
        </div>
        <a href="t-cookie.php?cookie=out" id="out">退出</a>
    </div>

</nav>

<div class="nav topx navbackground-t" id="nav">
    <div>
        <div style="border-bottom:1px solid rgba(255,255,255,.1)"><img src="../img/mini.png"></div>
    </div>
    <ul>
        <li class="nav-item">
            <a href="t-index.php"><i class="my-icon nav-icon icon_2"></i><span>首页</span><i class="my-icon nav-more"></i></a>

        </li>
        <li class="nav-item">
            <a href="t-mykt.php"><i class="my-icon nav-icon icon_1"></i><span>我的课题</span><i
                    class="my-icon nav-more"></i></a>
        </li>
        <li class="nav-item">
            <a href="t-checkproject.php"><i class="my-icon nav-icon icon_6"></i><span>选课核查</span><i
                    class="my-icon nav-more"></i></a>
        </li>
        <li class="nav-item">
            <a href="#"><i class="my-icon nav-icon icon_3"></i><span>评分评语</span><i class="my-icon nav-more"></i></a>
            <ul>
                <li>
                    <a href="t-GuideMark.php"><span>指导评分</span></a>
                </li>
                <li>
                    <a href="t-ThesisMark.php"><span>论文评分</span></a>
                </li>
                <li>
                    <a href="t-ReplyMark.php"><span>答辩评分</span></a>
                </li>
            </ul>
        </li>
        <li class="nav-item">
            <a href="t-all.php"><i class="my-icon nav-icon icon_6"></i><span>答辩汇总</span><i
                    class="my-icon nav-more"></i></a>

        </li>
        <li class="nav-item">
            <a href="#"><i class="my-icon nav-icon icon_3"></i><span>资料管理</span><i class="my-icon nav-more"></i></a>
            <ul>
                <li>
                    <a href="t-information.php"><span>我的资料</span></a>
                </li>
                <li>
                    <a href="t-mystudent.php"><span>我的学生</span></a>
                </li>

            </ul>
        </li>
    </ul>
</div>
<div class="indexborder">


        <div class="panel-body">
            <div class="indexdiv1 panel panel-default auto" align="center">
                <div class="panel" style="border:1px solid #8FBC8F"><!--panel-warning-->
                    <div class="panel-heading" style="background-color:#8FBC8F;">
                        <h3 class="panel-title ">我的学生</h3>
                    </div>
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                <tr>
                                    <th>学号</th>
                                    <th>姓名</th>
                                    <th>班级</th>
                                </tr>
                                </thead>
                                <?
                                $ssql = "select * from student where Teacher_TeacherId=$tid";
                                $sresault = $conn->query($ssql);
                                $i = 1;
                                while ($srow = $sresault->fetch_array()) {
                                    if ($i % 2 == 0) {
                                        ?>
                                        <tr class="success">
                                    <?
                                    } else { ?>
                                        <tr>
                                    <? }
                                    $i++; ?>
                                    <td><?= $srow['StudentId'] ?></td>
                                    <td><a href="#" title="个人信息" data-container="body" data-toggle="popover"
                                           data-placement="right" data-trigger="hover "
                                           data-content="<img src='../img/学生头像.png' width='30%' style='float:left'>性别：<?= $srow['Sex'] ?><br>手机：<?= $srow['Tel'] ?><br>系别：<?= $srow['Major'] ?>"
                                           data-html="true" onclick="open_s(<?=$srow['StudentId']?>)"><?= $srow['StudentName'] ?></a></td>
                                    <td><?=$srow['Class']?></td>
                                    <td>
                                        <input type="button" value="删除" style="background-color:#8FBC8F ;max-width: 50px;color:white" onclick="kill(<?=$srow['StudentId']?>)">
                                    </td>
                                    </tr>
                                <? } ?>

                            </table>

                        </div>
                    </div>


                    <div class="ms">
                        学号: <input type="text" id="selectStudent" value="" name="selectStudent" style="border:1px solid #000000;max-width: 150px;">

                        <button id="manage" name="manage" value="manage" onclick="manage()" style="color:white;max-width: 50px;">添加</button>


                    </div>


            </div>
        </div>




        <script type="text/javascript">
        </script>
        <script>
            window.jQuery || document.write('<script src="js/jquery-1.11.0.min.js"><\/script>')
        </script>
        <script type="text/javascript" src="js/nav.js"></script>
        <script type="text/javascript">
            function kill(id) {
                var msg = "您真的确定要修改吗？\n\n请确认！";
                if (confirm(msg) == true) {
                    alert(id);
                    $.ajax({
                        type: "POST",
                        url: "manage.php",
                        data: "selectStudent=" + id + "&selectType=t-deleteStudnet" + "&TecherId='<?=$tid?>'" + "&manage=manage",
                        success: function (msg) {
                            alert(msg);
                            myWindow = window.open("t-mystudent.php", "_self");
                        }
                    });
                }
            }
            //添加学生
            function manage() {
                var msg = "您确定要添加学生？请确认！";
                if (confirm(msg) == true) {
                    var id = document.getElementById("selectStudent").value;
                    alert(id);
                    $.ajax({
                        type: "POST",
                        url: "manage.php",
                        data: "selectStudent=" + id + "&selectType=t-addStudnet" + "&TecherId='<?=$tid?>'" + "&manage=manage",
                        success: function (msg) {
                            alert(msg);
                            myWindow = window.open("t-mystudent.php", "_self");
                        }
                    });
                }
            }
            function change(){
                document.getElementById("input1").readOnly = false;
                document.getElementById("input1").style.border="1px solid #000000";
                document.getElementById("input2").readOnly = false;
                document.getElementById("input2").style.border="1px solid #000000";
                document.getElementById("input3").readOnly = false;
                document.getElementById("input3").style.border="1px solid #000000";
                document.getElementById("input4").readOnly = false;
                document.getElementById("input4").style.border="1px solid #000000";
                document.getElementById("input5").readOnly = false;
                document.getElementById("input5").style.border="1px solid #000000";
                document.getElementById("input6").readOnly = false;
                document.getElementById("input6").style.border="1px solid #000000";
            }

            function save(t) {
                var a=t;
                var b=a.parentNode.parentNode.parentNode.getElementsByTagName("input");

                var datas=new Array();
                for(var i = 0; i < b.length; i++) {
                    datas[i]= encodeURI(b[i].value);
                }

                var msg = "您真的确定要修改吗？\n\n请确认！";
                if (confirm(msg)==true){
                    $.ajax({
                        type: "GET",
                        url: "manage.php",
                        data: "&TeacherId="+datas[0]+"&TeacherName="+datas[1]+"&Sex="+datas[2]+"&Tel="+datas[3]+
                        "&email="+datas[4]+"&QQ="+datas[5]+"&Depart="+datas[6]+"&saved=t-change",
                        error:function(msg){
                            return false
                        },
                        success: function(msg){
                            alert( msg );
//                    myWindow=window.open("t-information.php","_self");
                        }
                    });
                }

                for(var i = 0; i < b.length; i++) {
                    b[i].readOnly = true;
                    b[i].style.border = "0";
                }
            }
        </script>
        <script>
            window.jQuery || document.write('<script src="../js/jquery-1.11.0.min.js"><\/script>')
        </script>
        <script type="text/javascript" src="../js/nav.js"></script>
        <script type="text/javascript" src="../layer/layer.js"></script>
        <script type="text/javascript">  //弹窗实现
            function open_s(id){
                var path = "t-studentchange.php?Id=" + id;
                alert(path);

                layer.open({
                    type: 1,
                    area: ['80%', '80%'],
                    shadeClose: true, //点击遮罩关闭
                    content: "<iframe src=''  width='98%' height='94%' name=main frameborder= scrolling=NO id='testFrame'></iframe>"
                });
                var t = document.getElementById("testFrame");
                t.src = path;
            }
        </script>







         <script language="javascript">
                var flag;
                var n = 0;
                function checkstr(a) {
                    n = 0;
                    for(i = 0; i < a.length; i++) {
                        n++;

                    }
                    if(n==10) {
                        flag=true;
                    } else {
                        alert("输入用户名不正确，请重新输入！");
                        flag=false;
                    }
                }

                function chkinput(form) {
                    if(checkstr(form.username.value)) {

                        form.username.focus();

                    }
                    if(flag==true){

                        var a=form.username.value ;
                        alert("登录成功!");
                        if(a.toString()=='1111111111') {
                            myWindow=window.open('s-index.html', '_self');
                        }
                        else if(a.toString()=='2222222222') {
                            myWindow=window.open('t-index.html', '_self');
                        }
                        else if(a.toString()=='3333333333') {
                            myWindow=window.open('a-newsManage.html', '_self');
                        }
                        else{
                            form.username.value ="";
                            form.userpwd.value = "";
                        }

                    }
                    else {
                        form.username.value ="";
                        form.userpwd.value = "";
                    }
                }
            </script>
</body>

</html>
